﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:view="clr-namespace:Southridge.View"
	mc:Ignorable="d"
	x:Class="Southridge.View.ListingDetails"
	x:Name="UserControl"   
	d:DesignWidth="592" d:DesignHeight="345" xmlns:Southridge_View="clr-namespace:Southridge.View" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
	<UserControl.Resources>
        <ResourceDictionary> 
            <ResourceDictionary.MergedDictionaries> 
            
            </ResourceDictionary.MergedDictionaries>
                   
        <Southridge_View:ListingToOneLineAddressConverter x:Key="ListingToOneLineAddressConverter" /> 
		<!--<ObjectDataProvider x:Key="Listing" 
             ObjectInstance="{x:Static Southridge_View:DesignTimeViewModel.SingleListing}" d:IsDataSource="True"/>-->
		<DataTemplate x:Key="ImageDataTemplate">
			<Grid MouseEnter="ImagesListBox_MouseEnter">				
				<Image HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" 
					Source="{Binding}" />
                <!-- <TextBlock Text="{Binding}" VerticalAlignment="Bottom" Opacity="0.2"/> -->
            </Grid>			
		</DataTemplate>
		
		
		<ItemsPanelTemplate x:Key="ItemsPanelTemplate1">
			<WrapPanel IsItemsHost="True"/>
		</ItemsPanelTemplate>
		<SolidColorBrush x:Key="ListBorder" Color="#828790"/>
		<Style x:Key="ListBoxStyle1" TargetType="{x:Type ListBox}">
			<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
			<Setter Property="BorderBrush" Value="{DynamicResource ListBorder}"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
			<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
			<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
			<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ListBox}">
						<Border x:Name="Bd" SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="1">
							<ScrollViewer Padding="{TemplateBinding Padding}" Focusable="false">
								<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
							</ScrollViewer>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
							</Trigger>
							<Trigger Property="IsGrouping" Value="true">
								<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
			<Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
			<Setter Property="Padding" Value="2,0,0,0"/>    
            <Setter Property="Margin" Value="3,3,0,0" /> 
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ListBoxItem}">
						<Border x:Name="Bd" SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
							<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
						</Border>
						<ControlTemplate.Triggers>
							<!--<Trigger Property="IsMouseOver" Value="true" > 
								<Setter Property="IsSelected" Value="true" /> 
							</Trigger>--> 
							<Trigger Property="IsSelected" Value="true">
								<!--<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>-->
                                <Setter Property="Background" TargetName="Bd" Value="White"/>
								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
                                <Setter Property="BorderThickness" TargetName="Bd" Value="1" /> 
                                <Setter Property="BorderBrush" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
                                <Setter Property="BorderBrush" TargetName="Bd" Value="White"/>
                                </Trigger>
							<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition Property="IsSelected" Value="true"/>
									<Condition Property="Selector.IsSelectionActive" Value="false"/>
								</MultiTrigger.Conditions>
								<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
							</MultiTrigger>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style> 
		<Style x:Key="DetailsTitleStyle" TargetType="{x:Type TextBlock}"> 
			<Setter Property="FontSize" Value="28" /> 			 
		</Style>

        <Style x:Key="ActionButtonStyle" TargetType="{x:Type Button}">             
            <Setter Property="Background" Value="{DynamicResource FillOverDarkBorderBrush}" />
            <Setter Property="Foreground" Value="White" /> 
			<Setter Property="BorderThickness" Value="1" /> 
            <Setter Property="FontSize" Value="16" /> 
            <Setter Property="Margin" Value="5,5,0,0" /> 
            <Setter Property="MinHeight" Value="30" /> 
            <Setter Property="Padding" Value="4,2,4,2" /> 
			<Setter Property="Template" > 
				<Setter.Value> 
				 <ControlTemplate TargetType="{x:Type ButtonBase}">
	            	<Border x:Name="Chrome" SnapsToDevicePixels="True" CornerRadius="3"
						BorderThickness="1" 
						Background="{TemplateBinding Background}" 
						BorderBrush="{TemplateBinding BorderBrush}" 					>
	            		<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" ContentTemplate="{TemplateBinding ContentTemplate}" RecognizesAccessKey="True"/>
	            	</Border>
	            	 
	            </ControlTemplate>
				</Setter.Value> 				
			</Setter> 
			<Style.Triggers> 
				<Trigger Property="IsKeyboardFocused" Value="True">
	            	<Setter Property="BorderBrush" Value="White"/>
                    <Setter Property="Foreground" Value="White" />
                    </Trigger>
				<Trigger Property="IsMouseOver" Value="True">
	            	<Setter Property="BorderBrush" Value="White"/>					 
                    <Setter Property="Background" Value="{DynamicResource Brush_RibbonOverDarkBorderHighlight}" />
                    <Setter Property="Foreground" Value="White" />
                </Trigger>				 
            	<Trigger Property="IsEnabled" Value="False">
            		<Setter Property="Foreground" Value="#FFADADAD"/>
            	</Trigger>
			</Style.Triggers> 
        </Style>

           
          
        	
        </ResourceDictionary>
	</UserControl.Resources>
	 <Grid x:Name="LayoutRoot" 
          Background="{DynamicResource UserControlBackgroundBrush}"
          DataContext="{Binding Listing}"
          
           >
		   <!-- view:DataContextSetterBehavior.DataContext="{x:Static view:DesignTimeViewModel.SingleListing}" --> 
	 
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="388"/>
			<ColumnDefinition Width="*"/>            
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" /> 
			<RowDefinition Height="*" /> 
			<RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
		
		<Grid Grid.Row="0" Grid.ColumnSpan="2"> 
            <HeaderedContentControl Style="{DynamicResource GroupTitle}" Header="{Binding Path=Title}" /> 
		</Grid> 
         
		<ListBox x:Name="ImagesListBox" IsSynchronizedWithCurrentItem="True" 
			ItemsSource="{Binding Path=Images}" 
			ItemsPanel="{DynamicResource ItemsPanelTemplate1}" 
			ItemTemplate="{DynamicResource ImageDataTemplate}" 	
            ItemContainerStyle="{DynamicResource ListBoxItemStyle1}"			
			ScrollViewer.HorizontalScrollBarVisibility="Disabled" Grid.Column="0" 
			Grid.Row="1" Background="#00FFFFFF" /> 	
        <HeaderedContentControl Style="{DynamicResource GroupH1}" Header="Description" Grid.Row="2" FontSize="14">
		<Grid TextElement.FontSize="12">
			<Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/> 
                    <ColumnDefinition Width="*"  /> 				 
				<ColumnDefinition Width="*" /> 
				<ColumnDefinition Width="Auto"  /> 			 				
			</Grid.ColumnDefinitions> 
			<Grid.RowDefinitions> 
				<RowDefinition Height="Auto" MinHeight="25" /> 
				<RowDefinition Height="Auto" MinHeight="25"/> 
				<RowDefinition Height="Auto"/> 
				<RowDefinition Height="*" /> 
			</Grid.RowDefinitions>			
			<!--- Row 0 --> 			
			<TextBlock Text="{Binding Path=Price, StringFormat=$\{0\}}" Style="{DynamicResource SimpleLabelBold}" Grid.Row="0" />			
			<StackPanel Grid.Column="1" Orientation="Horizontal" Grid.Row="0" > 
				<TextBlock Text="Bedrooms" Style="{DynamicResource SimpleLabel}" /> 
				<TextBlock Text="{Binding Path=BedroomCount}" Style="{DynamicResource SimpleLabelBold}"  /> 
			</StackPanel> 
			<StackPanel Grid.Column="2" Orientation="Horizontal" Grid.Row="0" > 
			<TextBlock Text="Bath Rooms" Style="{DynamicResource SimpleLabel}"/> 
			<TextBlock Text="{Binding Path=BathroomCount}" Style="{DynamicResource SimpleLabelBold}"/> 			
			</StackPanel> 
			<StackPanel Grid.Column="3" Orientation="Horizontal" Grid.Row="0" > 
				<TextBlock Text="Sq ft"  Style="{DynamicResource SimpleLabel}"/> 
				<TextBlock Text="{Binding Path=SquareFootage}" Style="{DynamicResource SimpleLabelBold}"/> 				 
			</StackPanel> 			
			<!-- Row 1 --> 			
			<TextBlock Text="{Binding Path='', Converter={StaticResource ListingToOneLineAddressConverter}}" 
				Grid.ColumnSpan="4" Grid.Row="1" Style="{DynamicResource SimpleLabelBold}" /> 
			<StackPanel Grid.Row="1" Grid.Column="3" Orientation="Horizontal" HorizontalAlignment="Right" d:LayoutOverrides="GridBox" > 
				<TextBlock Text="MLS:"  /> 
				<TextBlock Text="{Binding Path=MLS}" Style="{DynamicResource SimpleLabelBold}" /> 
			</StackPanel> 
			<!-- Row 2 --> 
			<TextBlock Text="{Binding Path=Description}" Grid.Row="2" Grid.ColumnSpan="4" MinHeight="50" TextWrapping="Wrap" d:LayoutOverrides="GridBox" Style="{DynamicResource SimpleLabel}"  /> 
			<!-- Row 3 --> 							
		</Grid>
        </HeaderedContentControl>
        <WrapPanel Margin="5,0,0,0" Grid.Column="1" Grid.Row="2"   >			 
				<Button Content="Make appointment" Style="{DynamicResource ActionButtonStyle}" 
                        Command="{Binding  ElementName=UserControl, Path=DataContext.CreateAppointmentCommand}" /> 
				<Button Content="Email listing"  Style="{DynamicResource ActionButtonStyle}" /> 
				<Button Content="Add to favorites"   Style="{DynamicResource ActionButtonStyle}"/> 				 
		</WrapPanel>
		<Image Grid.Row="1" Grid.Column="1"
			Source="{Binding Path=SelectedItem, ElementName=ImagesListBox}" VerticalAlignment="Stretch" Stretch="Uniform"  />
        <HeaderedContentControl Style="{DynamicResource GroupH1}" Header="Neighborhood" Grid.Row="3" FontSize="14" Content="{Binding Neighborhood}" ContentTemplate="{StaticResource NeighborhoodVisualDataTemplate}" > 
             
        </HeaderedContentControl>        
    </Grid>
</UserControl>